<!DOCTYPE html>
<html lang='en'>
<head>
    <meta charset='UTF-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script src='../vue.js'></script>
</head>
<body>
    <div id='app'>
        <form action="####">
            <!-- v-model修饰符 .trim收集表单数据的时候 去掉前后的空格 -->
            <input type="text" name="username" v-model.trim="userInfo.username">
            <!-- v-model修饰符 .lazy 把收集表单实时收集,改为失去焦点后才开始收集,类比js的input事件和change事件 -->
            <br>
            <input type="password" name="password" v-model.lazy="userInfo.password">
            <br>
            <!-- v-model修饰符 .number收集数据的时候直接转为number类型,如果无法转为正常的数字,则保持原来的字符串格式 -->
            <input type="text" name="age" v-model.number="userInfo.age">
            请选择你喜欢的城市
            <input type="checkbox" name="city" v-model="userInfo.city" value="广东">广东
            <input type="checkbox" name="city" v-model="userInfo.city" value="深圳">深圳
            <input type="checkbox" name="city" v-model="userInfo.city" value="北京">北京
            <input type="checkbox" name="city" v-model="userInfo.city" value="上海">上海        
        </form>

    </div>
    <script>
        Vue.config.productionTip = false;
        const vm = new Vue({
            el:'#app',
            data(){
                return {
                userInfo:{
                    username:'',
                    password:'',
                    age:null,
                    city:[]
                }
            }
            }
    })
    </script>
</body>
</html>